package com.csti.delio.pagos.client.empleados;

import com.csti.delio.main.client.idioma.DelioConstants;

import com.csti.delio.main.client.util.ColumnField;
import com.csti.delio.main.client.util.Utilities;
import com.csti.delio.pagos.client.contratos.PanelNuevoContrato;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.binding.FormBinding;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.FormButtonBinding;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.HiddenField;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.google.gwt.core.client.GWT;

public class PanelNuevoEmpleado extends FormPanel {

	private DelioConstants k = GWT.create(DelioConstants.class);
	
	private Button btnRegistrar;
	private FormButtonBinding formbuttonbinding;
	@SuppressWarnings("unused")
	private FormBinding formbinding;
	private HiddenField<String> id;
	private TextField<String> txtDni;
	private TextField<String> txtNombres;
	private TextField<String> txtApellidos;
	private TextField<String> txtDomicilio;
	private TextField<String> txtTelefono;
	private TextField<String> txtCelular;
	private TextField<String> txtCorreo;

	public PanelNuevoEmpleado() {
		super();
		setHeading(k.NuevoEmpleado());
		setFrame(true);
		setLabelAlign(LabelAlign.TOP);

		btnRegistrar = new Button(k.registrar());
		btnRegistrar.setSize(120,40);
		formbinding = new FormBinding(this, true);
		formbuttonbinding = new FormButtonBinding(this);
		formbuttonbinding.addButton(btnRegistrar);

		id = new HiddenField<String>();

		txtDni = new TextField<String>();
		txtDni.setFieldLabel(k.dni());
		txtDni.setAllowBlank(false);
		

		txtNombres = new TextField<String>();
		txtNombres.setFieldLabel(k.Nombres());
		txtNombres.setAllowBlank(false);
		Utilities.setNumerosEnteros(txtDni);
		Utilities.setLengh(txtDni, txtNombres,8);

		txtApellidos = new TextField<String>();
		txtApellidos.setFieldLabel(k.Apellidos());
		txtApellidos.setAllowBlank(false);

		txtDomicilio = new TextField<String>();
		txtDomicilio.setFieldLabel(k.Domicilio());
		txtDomicilio.setAllowBlank(false);

		txtTelefono = new TextField<String>();
		txtTelefono.setFieldLabel(k.Telefono());
		txtTelefono.setAllowBlank(false);

		txtCelular = new TextField<String>();
		txtCelular.setFieldLabel(k.Celular());
		txtCelular.setAllowBlank(false);
		Utilities.setNumerosEnteros(txtTelefono);
		Utilities.setLengh(txtTelefono, txtCelular,8); 
		
		
		txtCorreo = new TextField<String>();
		txtCorreo.setFieldLabel(k.Correo());
		txtCorreo.setAllowBlank(false);
		
		Utilities.setNumerosEnteros(txtCelular);
		Utilities.setLengh(txtCelular, txtCorreo,8); 
		

		add(id);
		
		ColumnField cf=new ColumnField();
		cf.setDerechaTop(txtDni, new FormData("60%"));
		cf.setIzquierdaTop(txtNombres, new FormData("100%"));
		add(cf, new FormData("95%"));
		
		add(txtApellidos, new FormData("95%"));
		add(txtDomicilio, new FormData("95%"));
	
		cf=new ColumnField();
		cf.setDerechaTop(txtTelefono, new FormData("95%"));
		cf.setIzquierdaTop(txtCelular, new FormData("100%"));
		add(cf, new FormData("95%"));
		
		add(txtCorreo, new FormData("95%"));
		
		add(new PanelNuevoContrato(),new FormData("95%"));
		
		addButton(btnRegistrar);
		setButtonAlign(HorizontalAlignment.CENTER);

	}
}
